package com.kgc.scd.controller;

import com.kgc.scd.annotation.RequestPermission;
import com.kgc.scd.annotation.RequestUser;
import com.kgc.scd.bean.SearchHistory;
import com.kgc.scd.service.SearchService;
import com.kgc.scd.util.RequestResult;
import com.kgc.scd.util.UserAnno;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created On : 2022/6/17.
 * <p>
 * Author     : hi
 * <p>
 * Description: SearchController
 */
@Slf4j
@RestController
@Api(tags = "06、搜索历史记录入口")
public class SearchController {

    @Autowired
    private SearchService searchService;


    @RequestPermission
    @PostMapping("/searchHistoryLists")
    @ApiOperation(value = "历史记录", notes = "根据用户")
    @ApiResponses({
            @ApiResponse(code = 200, message = "SUCCESS"),
            @ApiResponse(code = 500, message = "展示历史记录失败！")
    })
    public RequestResult<List<Object>> searchHistoryList (@RequestUser UserAnno userAnno){
       return searchService.searchHistoryList(userAnno.getUserId());
    }

}
